<?php

class TLoader_Dir extends TLoader{
    function __construct(){
    }
    function getTest($path){
        if(is_dir($path)){
            $suite_name = basename($path);
            $test_suite = new Test_Suite($suite_name);
            $files = scandir($path);
            foreach($files as $filepath){
                if($filepath == "." || $filepath == ".."){
                    continue;
                }
                $filepath="${path}/${filepath}";
                $sub_test_suite = TLoader_Instance::get($filepath)->getTest($filepath);
                $test_suite->add($sub_test_suite);
            }
            return $test_suite;
        }
        else{
            return new Test_Suite_Bad('Bad Suite','not dir for testsuite');
        }
    }
}

?>
